package samoloty.data;

import java.util.ArrayList;
import samoloty.model.IDataModel;
import samoloty.model.models.AcRegModel;
import samoloty.model.models.ConfigurationModel;
import samoloty.model.models.ConstModel;
import samoloty.model.models.CrewModel;
import samoloty.model.models.FuelModel;
import samoloty.model.models.HoldsModel;
import samoloty.model.models.IdealTrimModel;
import samoloty.model.models.LimitLawModel;
import samoloty.model.models.LimitTowModel;
import samoloty.model.models.LimitTowffModel;
import samoloty.model.models.LimitZfwModel;
import samoloty.model.models.LimitZfwffModel;
import samoloty.model.models.MaxWeightsModel;
import samoloty.model.models.PantryModel;
import samoloty.model.models.PaxModel;
import samoloty.model.models.StabTrimModel;
import samoloty.model.models.StabTrimSubModel;
import samoloty.model.models.StabTrimSubSubModel;

public class DataBase2 extends CommonDataBase implements IDataModel {

    public DataBase2() {
        super();
        initData();
    }

    public ArrayList<String> getAcReg() {
        return acRegData;
    }

    public ArrayList<ConfigurationModel> getConfiguration() {
        return configuration;
    }

    public ConstModel getConst() {
        return constData;
    }

    public ArrayList<CrewModel> getCrew() {
        return crewData;
    }

    public ArrayList<FuelModel> getFuel() {
        return fuelData;
    }

    public ArrayList<HoldsModel> getHolds() {
        return holdsData;
    }

    public ArrayList<LimitLawModel> getLimitLaw() {
        return limitLawData;
    }

    public ArrayList<LimitTowModel> getLimitTow() {
        return limitTowData;
    }

    public ArrayList<LimitTowffModel> getLimitTowff() {
        return limitTowffData;
    }

    public ArrayList<LimitZfwModel> getLimitZfw() {
        return limitZfwData;
    }

    public ArrayList<LimitZfwffModel> getLimitZfwff() {
        return limitZfwffData;
    }

    public MaxWeightsModel getMaxWeights() {
        return maxWeightsData;
    }

    public PantryModel getPantry() {
        return pantryData;
    }

    public ArrayList<PaxModel> getPax() {
        return paxData;
    }

    public StabTrimModel getStabTrimFlap1() {
        return stabTrimFlap1Data;
    }

    public StabTrimModel getStabTrimFlap2() {
        return stabTrimFlap2Data;
    }

    public StabTrimModel getStabTrimFlap3() {
        return stabTrimFlap3Data;
    }

    public StabTrimModel getStabTrimFlap4() {
        return stabTrimFlap4Data;
    }

    public ArrayList<IdealTrimModel> getIdealTrim() {
        return idealTrimData;
    }

    private void initData() {
        initAcReg();
        initConst();
        initCrew();
        initConfiguratin();
        initFuel();
        initHolds();
        initLimitLaw();
        initLimitTow();
        initLimitTowff();
        initLimitZfw();
        initLimitZfwff();
        initPantry();
        initPax();
        initMaxWeights();
        initStabTrimFlap1();
        initIdealTrim();
    }

    private void initAcReg() {
        acRegData = new ArrayList<String>();
        acRegData.add(new String("SP-LFA"));
        acRegData.add(new String("SP-LFB"));
        acRegData.add(new String("SP-LFC"));
        acRegData.add(new String("SP-LFD"));
        acRegData.add(new String("SP-LFE"));
        acRegData.add(new String("SP-LFF"));
        acRegData.add(new String("SP-LFG"));
        acRegData.add(new String("SP-LFH"));

    }

    private void initConst() {
        constData = new ConstModel(150, 50, 14.18, 13.604, 2.303);
    }

    private void initCrew() {
        crewData = new ArrayList<CrewModel>();
        crewData.add(new CrewModel("2/0", 2, 0, 170, -10.930));
        crewData.add(new CrewModel("2/1", 2, 1, 245, -6.850));
        crewData.add(new CrewModel("2/2", 2, 2, 320, -10.060));
        crewData.add(new CrewModel("3/0", 3, 0, 255, -16.390));
        crewData.add(new CrewModel("3/1", 3, 1, 330, -12.310));
        crewData.add(new CrewModel("3/2", 3, 2, 405, -15.520));

    }

    private void initConfiguratin() {
        configuration = new ArrayList<ConfigurationModel>();
        configuration.add(new ConfigurationModel("Y64", 0, 64, 0, 20, 0, 28, 0, 16));
        configuration.add(new ConfigurationModel("C4Y60", 4, 60, 0, 20, 0, 28, 4, 12));
        configuration.add(new ConfigurationModel("C8Y56", 8, 56, 0, 20, 0, 28, 8, 8));
        configuration.add(new ConfigurationModel("C12Y52", 12, 52, 0, 20, 0, 28, 12, 4));
        configuration.add(new ConfigurationModel("C16Y48", 16, 48, 0, 20, 0, 28, 16, 0));
        configuration.add(new ConfigurationModel("C20Y44", 20, 44, 0, 20, 4, 24, 16, 0));
        configuration.add(new ConfigurationModel("C24Y40", 24, 40, 0, 20, 8, 20, 16, 0));
        configuration.add(new ConfigurationModel("C28Y36", 28, 36, 0, 20, 12, 16, 16, 0));
        configuration.add(new ConfigurationModel("C36Y28", 36, 28, 0, 20, 20, 8, 16, 0));
        configuration.add(new ConfigurationModel("C40Y24", 40, 24, 0, 20, 24, 4, 16, 0));
        configuration.add(new ConfigurationModel("C44Y20", 44, 20, 0, 20, 28, 0, 16, 0));
        configuration.add(new ConfigurationModel("C48Y16", 48, 16, 4, 16, 28, 0, 16, 0));
        configuration.add(new ConfigurationModel("C52Y12", 52, 12, 8, 12, 28, 0, 16, 0));
        configuration.add(new ConfigurationModel("C56Y8", 56, 8, 12, 8, 28, 0, 16, 0));
        configuration.add(new ConfigurationModel("C64", 64, 0, 20, 0, 28, 0, 16, 0));

    }

    private void initFuel() {
        fuelData = new ArrayList<FuelModel>();
        fuelData.add(new FuelModel(0, 0));
        fuelData.add(new FuelModel(500, 1));
        fuelData.add(new FuelModel(1000, 1.9));
        fuelData.add(new FuelModel(1500, 2.7));
        fuelData.add(new FuelModel(2000, 3.6));
        fuelData.add(new FuelModel(2500, 4.5));
        fuelData.add(new FuelModel(3000, 5.3));
        fuelData.add(new FuelModel(3500, 6.2));
        fuelData.add(new FuelModel(4000, 7.1));
        fuelData.add(new FuelModel(4500, 7.9));
        fuelData.add(new FuelModel(5000, 8.3));

    }

    private void initHolds() {
        holdsData = new ArrayList<HoldsModel>();
        holdsData.add(new HoldsModel("5L", 448, -0.04989));
        holdsData.add(new HoldsModel("5R", 480, -0.04989));
        holdsData.add(new HoldsModel("6", 744, 0.06477));

    }

    private void initLimitZfw() {
        limitZfwData = new ArrayList<LimitZfwModel>();
        limitZfwData.add(new LimitZfwModel(13500, 33.4, 13500, 60.8));
        limitZfwData.add(new LimitZfwModel(14700, 35.3, 19700, 74.3));
        limitZfwData.add(new LimitZfwModel(18000, 27.9, 19700, 74.3));
        limitZfwData.add(new LimitZfwModel(19700, 33.7, 19700, 74.3));

    }

    private void initLimitTow() {
        limitTowData = new ArrayList<LimitTowModel>();
        limitTowData.add(new LimitTowModel(13500, 33.4, 13500, 60.8));
        limitTowData.add(new LimitTowModel(14700, 35.3, 19700, 74.3));
        limitTowData.add(new LimitTowModel(18000, 27.9, 21350, 77.9));
        limitTowData.add(new LimitTowModel(19700, 33.7, 22000, 79.3));
        limitTowData.add(new LimitTowModel(21350, 39.3, 22000, 79.3));
        limitTowData.add(new LimitTowModel(22000, 41.5, 22000, 79.3));

    }

    private void initLimitLaw() {
        limitLawData = new ArrayList<LimitLawModel>();
        limitLawData.add(new LimitLawModel(13500, 33.4, 13500, 60.8));
        limitLawData.add(new LimitLawModel(14700, 35.3, 19700, 74.3));
        limitLawData.add(new LimitLawModel(18000, 27.9, 21350, 77.9));
        limitLawData.add(new LimitLawModel(19700, 33.7, 21350, 77.9));
        limitLawData.add(new LimitLawModel(21350, 39.3, 21350, 77.9));

    }

    private void initLimitZfwff() {
        limitZfwffData = new ArrayList<LimitZfwffModel>();
        limitZfwffData.add(new LimitZfwffModel(13500, 33.4, 13500, 60.8));
        limitZfwffData.add(new LimitZfwffModel(14700, 35.3, 19700, 74.3));
        limitZfwffData.add(new LimitZfwffModel(18000, 27.9, 19700, 74.3));
        limitZfwffData.add(new LimitZfwffModel(19700, 33.7, 19700, 74.3));

    }

    private void initLimitTowff() {
        limitTowffData = new ArrayList<LimitTowffModel>();
        limitTowffData.add(new LimitTowffModel(13500, 33.4, 13500, 60.8));
        limitTowffData.add(new LimitTowffModel(14700, 35.3, 19700, 74.3));
        limitTowffData.add(new LimitTowffModel(18000, 27.9, 21350, 77.9));
        limitTowffData.add(new LimitTowffModel(19700, 33.7, 22000, 79.3));
        limitTowffData.add(new LimitTowffModel(21350, 39.3, 22000, 79.3));
        limitTowffData.add(new LimitTowffModel(22000, 41.5, 22000, 79.3));

    }

    private void initPantry() {
        pantryData = new PantryModel(0, 0.00000, 0.00000, 0.00000, 764, 0.04799);

    }

    private void initPax() {
        paxData = new ArrayList<PaxModel>();
        paxData.add(new PaxModel("0A", -0.02740));
        paxData.add(new PaxModel("0B", 0.00409));
        paxData.add(new PaxModel("0C", 0.03297));

    }

    private void initMaxWeights() {
        maxWeightsData = new MaxWeightsModel(22030, 22000, 19700, 21350);
    }

    private void initStabTrimFlap1() {
        ArrayList<StabTrimSubModel> stabTrimSub = new ArrayList<StabTrimSubModel>();
        ArrayList<StabTrimSubSubModel> stabMacs1 = new ArrayList<StabTrimSubSubModel>();
        stabMacs1.add(new StabTrimSubSubModel(14, 2.5));
        stabMacs1.add(new StabTrimSubSubModel(37, 0));
        ArrayList<StabTrimSubSubModel> stabMacs2 = new ArrayList<StabTrimSubSubModel>();
        stabMacs2.add(new StabTrimSubSubModel(14, 2.5));
        stabMacs2.add(new StabTrimSubSubModel(37, 0));
        stabTrimSub.add(new StabTrimSubModel("FLAP 1", 13500, stabMacs1));
        stabTrimSub.add(new StabTrimSubModel("", 22000, stabMacs2));
        stabTrimFlap1Data = new StabTrimModel(stabTrimSub);
    }

    private void initIdealTrim() {
        idealTrimData = new ArrayList<IdealTrimModel>();
        idealTrimData.add(new IdealTrimModel(12000, 50));
        idealTrimData.add(new IdealTrimModel(19700, 50));

    }

    public String getLabel() {
        return "ATR-72";
    }
    private ArrayList<String> acRegData;
    private ConstModel constData;
    private ArrayList<CrewModel> crewData;
    private ArrayList<ConfigurationModel> configuration;
    private ArrayList<FuelModel> fuelData;
    private ArrayList<HoldsModel> holdsData;
    private ArrayList<LimitZfwModel> limitZfwData;
    private ArrayList<LimitTowModel> limitTowData;
    private ArrayList<LimitLawModel> limitLawData;
    private ArrayList<LimitZfwffModel> limitZfwffData;
    private ArrayList<LimitTowffModel> limitTowffData;
    private PantryModel pantryData;
    private ArrayList<PaxModel> paxData;
    private MaxWeightsModel maxWeightsData;
    private StabTrimModel stabTrimFlap1Data;
    private StabTrimModel stabTrimFlap2Data;
    private StabTrimModel stabTrimFlap3Data;
    private StabTrimModel stabTrimFlap4Data;
    private ArrayList<IdealTrimModel> idealTrimData;
}
